﻿Imports CupsApp.Service
Imports CupsApp.Data
Imports MsdnMag.Web.Controls

Partial Public Class _exit
    Inherits System.Web.UI.Page

    Public _data As New ExitInterview
    Public _service As New CupsDomainService
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        _data = New ExitInterview()
        _service = New CupsDomainService
        lvlMsg.Text = ""
        If Not IsPostBack Then
            If IsNothing(Request.QueryString("clientID")) Then
                CType(Master.FindControl("lnkNewClient"), LinkButton).Enabled = False
                CType(Master.FindControl("lnkNewClient"), LinkButton).Text = "> New Client/Family <"
            Else
                Client_ID.Value = Request.QueryString("clientID")
                _data = _service.GetExitInterview(Client_ID.Value)
                wwDataBinder1.DataBind()
            End If
        End If
    End Sub

#Region "Click Events"

    Protected Sub lnkPersonal_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkPersonal.Click
        Response.Redirect(String.Format("personal.aspx?clientID={0}", Client_ID.Value))
    End Sub

    Protected Sub lnkBackground_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkBackground.Click
        Response.Redirect(String.Format("background.aspx?clientID={0}", Client_ID.Value))
    End Sub

    Protected Sub lnkHealthLegal_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkHealthLegal.Click
        Response.Redirect(String.Format("health_legal.aspx?clientID={0}", Client_ID.Value))
    End Sub

    Protected Sub lnkHousing_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkHousing.Click
        Response.Redirect(String.Format("housing.aspx?clientID={0}", Client_ID.Value))
    End Sub

    Protected Sub lnkStatus_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkStatus.Click
        Response.Redirect(String.Format("status.aspx?clientID={0}", Client_ID.Value))
    End Sub

    Protected Sub lnkFollowUp_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkFollowUp.Click
        Response.Redirect(String.Format("follow_up.aspx?clientID={0}", Client_ID.Value))
    End Sub

#End Region


    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
        wwDataBinder1.Unbind()
        _service.UpdateExitInterview(Client_ID.Value, _data)
        lvlMsg.Text = "* Status information was saved successfully!"
    End Sub
End Class